import { useState } from "react";
import { Button } from "antd";

export default () => {
    const [obj, setObj] = useState<any>({ name: 'A', count: 1 });

    return (
        <div style={{ padding: 32 }}>
            <p>{JSON.stringify(obj)}</p>
            <Button type='primary' onClick={() => {
                const newObj = {...obj};
                newObj.count = newObj.count + 1;
                setObj(newObj);
            }}>加一</Button>
        </div>
    );
}